perm filename ANTEAT.SAI[ALF,DEK] blob
sn#510426 filedate 1980-05-15 generic text, type T, neo UTF8
Begin "Anteater"
Require "{}{}" delimiters;
Define ! = { comment };
Define
ten = true,
debugging = false,
verbose = false,
easy = { ifc not debugging thenc simple endc },
loop = { while true do begin },
cr = { ('15 & null) },
lf = { ('12 & null) },
crlf = { ('15 & '12) },
RH(word) = { (word land '777777) },
LH(word) = { RH( (word rot 18) ) },
glyphs = ('200-1),
end!of!memory = ('100000-1);
Integer
infile; ! Input file;
Integer array
Word [0:end!of!memory]; ! "Memory";
ifc ten thenc
Integer count, brchar, eof, badfile;
Easy Procedure Open!ant;
Begin "open .ANT"
Open(infile←Getchan,"DSK",8,2,0,count,brchar,eof);
Loop
Print(crlf, "What is the .ANT file to input? ");
Lookup( infile, Inchwl, badfile );
If not badfile then DONE;
Print("Couldn't find file.",crlf);
end;
end "open .ANT";
elsec
Define eof = {!skip!};
External integer !skip!;
Easy Procedure Open!ant;
Begin "open .ANT"
Print(crlf, "What is the .ANT file to input? ");
infile ← Openfile( null, "RC" );
end "open .ANT";
endc
Easy Procedure Examine (Integer address);
Begin "examine"
Integer width,digits;
Getformat(width,digits); Setformat(6,7);
Print(CVOS(address),": ",
CVOS(LH(word[address]))," ",CVOS(RH(word[address])),crlf);
Setformat(width,digits);
end "examine";
Easy Procedure Core!dump;
Begin "core dump"
Integer address;
For address ← 0 step 1 until end!of!memory do
If word[address] then Examine(address);
Print(crlf);
end "core dump";
Easy Procedure Printer (String mode("T"),filename(null));
Setprint(filename,mode);
Easy Procedure Inputting;
Begin "inputting"
Integer address;
Open!ant;
address ← 0;
While not eof do begin
word[address] ← Wordin(infile);
ifc verbose thenc Examine(address); endc
address ← address + 1;
end;
ifc ten thenc Release(infile) elsec Cfile(infile) endc;
end "inputting";
Easy Procedure Boundary (Integer address);
Begin "boundary"
Integer lastword;
Print(word[address]," bytes of boundary data...",crlf);
lastword ← address + word[address]%4 - (word[address] mod 4 > 0);
For address ← address+1 step 1 until lastword do Examine(address);
Print(crlf);
end "boundary";
Easy Procedure Components (Integer address);
Begin "subglyph"
Print("(Baseline) "); Examine(address);
Print("(Positions) "); Examine(address+1);
Print("(Times, ↑Data) "); Examine(address+2);
Print("(Width in rsu) "); Examine(address+3); Print(crlf);
Boundary(RH(word[address+2]));
end "subglyph";
Easy Procedure Outputting;
Begin "outputting"
Integer address, subglyph;
Printer("F");
ifc debugging thenc Core!dump; Printer("B"); endc
For address ← 0 step 1 until glyphs do
If word[address] then begin
Print("Glyph "); Examine(address); Print(crlf);
For subglyph ← 0 step 1 until (LH(word[address])-1) do begin
Print("Subglyph #",subglyph+1,crlf);
Components(RH(word[address])+4*subglyph);
end;
Print(crlf);
end;
Print("(ID number) "); Examine(address);
Print("(Multipliers) "); Examine(address ← address+1); Print(crlf);
Printer;
end "outputting";
Inputting;
Outputting;
end "Anteater"